package day05;

import java.util.Arrays;

public class SelectionSort {
    public static void main(String[] args) {
        int[] arr = new int[10];
        int n = arr.length;
        for (int i = 0; i < n; i++){
            arr[i] = (int)(Math.random() * 100 + 1);
        }
        System.out.println(Arrays.toString(arr));

        for (int j = 0; j < n - 1; j++){
            int minIndex = j;
            for (int i = j + 1; i < n; i++){
                if (arr[i] < arr[minIndex]){
                    minIndex = i;
                }
            }
            int temp = arr[j];
            arr[j] = arr[minIndex];
            arr[minIndex] = temp;
        }
        System.out.println(Arrays.toString(arr));

    }
}
